# !/usr/bin/python
# -*- coding: utf-8 -*-

# mediaplex
# multimedia platform
#
# this file is licensed under the MIT license
# read "LICENSE.MIT" in the root of this distribution

__authors__ = 'Jan Jokela <janjokela@gmail.com>'
__description__ = 'Plugin manager'

import os, sys
manager = None

class PluginManager:
    def __init__(self):
        self.plugins = []
        self.plugin_path = os.path.join(sys.path[0], 'mediaplex', 'plugins')
        self._check_plugins()
    def register(self, plugin):
        self.plugins.append(plugin)
    def unregister(self, plugin):
        self.plugins.remove(plugin)
    def get(self):
        return self.plugins
    def _check_plugins(self):
        paths = os.listdir(self.plugin_path)
        for path in paths:
            file = os.path.join(path, os.path.basename(path) + '.py')
            __import__()

